package com.jpyl.jpMedicalTreatment.view.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.jpyl.jpMedicalTreatment.R;

import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * 病人首页-检查日期-详情界面
 * Created by 15697 on 2019/2/27.
 */

public class CheckDetailsAdapter extends BaseAdapter {
    List<String> list;
    Context context;

    public CheckDetailsAdapter(Context context, List<String> list) {
        this.context = context;
        this.list = list;
    }

    @Override
    public int getCount() {
        return list.size();
    }

    @Override
    public Object getItem(int i) {
        return list.get(i);
    }

    @Override
    public long getItemId(int i) {
        return i;
    }

    @Override
    public View getView(int i, View view, ViewGroup viewGroup) {
        ViewHolder viewHolder;
        if (view == null) {
            view = LayoutInflater.from(context).inflate(R.layout.activity_item_check_details, null);
            viewHolder = new ViewHolder(view);
            view.setTag(viewHolder);
        } else {
            viewHolder = (ViewHolder) view.getTag();
        }
        viewHolder.tvName.setText(list.get(i));
        return view;
    }

    static class ViewHolder {
        @BindView(R.id.tv_itemCheckDetail_name)
        TextView tvName;

        ViewHolder(View view) {
            ButterKnife.bind(this, view);
        }
    }
}
